﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SmartCity.BasicData.Api.Application.Commond.GridType;
using SmartCity.BasicData.Api.Application.Commond.ProfessionalGrid;
using SmartCity.BasicData.Common;
using SmartCity.BasicData.Domain;
using SmartCity.BasicData.Repo;

namespace SmartCity.BasicData.Api.Controllers
{
    /// <summary>
    /// 网格类型管理--API
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class GridTypeController : ControllerBase
    {
        private readonly IMediator mediator;

        public GridTypeController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 通过中介者组件获取GridType列表
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<IList<GridTypeListDTO>>> GetGridType([FromQuery]GetGridTypeCommand command) {
            return mediator.Send(command);
        }
        /// <summary>
        /// 获取所有专业网格列表
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<PrefessionalDTO>>> GetAllProfessional()
        {
            return mediator.Send(new QueryPrefessionalCommand());
        }
    }
}
